import React from 'react'
import ReactDOM from 'react-dom'

import PropTypes from 'prop-types'
class App extends React.Component {
  state = {
    num: '叶树森',
  }
  render() {
    return (
      <>
        <Mycard title={'1'} options={{ label: 11, value: '222' }}>
          <div>鸡腿真好吃</div>
        </Mycard>
        <Mycard title={'美景'}>
          <div>白云山</div>
        </Mycard>
      </>
    )
  }
}
class Mycard extends React.Component {
  // 校验准则
  static propTypes = {
    title: PropTypes.string,
    // children:PropTypes.func
    // children:PropTypes.node
    // children:PropTypes.any
    // 特定结构的对象
    options: PropTypes.shape({
      value: PropTypes.string,
      label: PropTypes.number,
    }),
  }
  render() {
    return (
      <>
        <h1>{this.props.title}</h1>
        <h2>{this.props.children}</h2>
      </>
    )
  }
}

ReactDOM.render(<App />, document.getElementById('root'))
